import Vue from "vue";
import Router from "vue-router";
import HelloWorld from "components/HelloWorld";
import WorkInfo from "@/views/WorkInfo";
import WorkInfoDetails from "@/views/WorkInfoDetails";
import AdminLogin from "@/views/AdminLogin";
import AdminSignup from "@/views/AdminSignup";
import AdminIndex from "@/views/AdminIndex";
import AdminWorkInfo from "components/backEnd/AdminWorkInfoManage";
import AddWorkInfo from "components/backEnd/AddWorkInfo";

Vue.use(Router);

// 定义动态路由

export default new Router({
  base: process.env.BASE_URL,

  routes: [
    {
      path: "/test-vue",
      name: "TestVue",
      component: HelloWorld
    },
    {
      path: "/admin/:userName",
      name: "Admin",
      component: AdminIndex,
      children: [
        {
          path: "/admin-work-info",
          name: "AdminWorkInfo",
          component: AdminWorkInfo
        },
        {
          path: "/add-work-info",
          name: "AddWorkInfo",
          component: AddWorkInfo
        }
      ]
    },
    {
      path: "/login",
      name: "Login",
      component: AdminLogin
    },
    {
      path: "/signup",
      name: "Signup",
      component: AdminSignup
    },

    {
      path: "/",
      name: "WorkInfo",
      component: WorkInfo
    },
    {
      path: "/work-info-details/:id",
      name: "WorkInfoDetails",
      component: WorkInfoDetails
    }
  ]
});
